package xuegao.study.mall.rbac.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xuegao.study.mall.common.model.ums.UmsMemberReceiveAddress;
import xuegao.study.mall.rbac.service.UmsMemberReceiveAddressService;
import xuegao.study.mall.repo.dao.ums.UmsMemberReceiveAddressDao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UmsMemberReceiveAddressServiceImpl implements UmsMemberReceiveAddressService {

    @Autowired
    private UmsMemberReceiveAddressDao umsMemberReceiveAddressDao;

    @Override
    public int add(UmsMemberReceiveAddress address) {
        return umsMemberReceiveAddressDao.insert(address);
    }

    @Override
    public int update(Long id, UmsMemberReceiveAddress address) {
        return 0;
    }

    @Override
    public List<UmsMemberReceiveAddress> list(Long memberId) {
        Map<String, Object> params = new HashMap<>();
        params.put("member_id", memberId);
        return umsMemberReceiveAddressDao.selectByMap(params);
    }

    @Override
    public UmsMemberReceiveAddress getItem(Long id) {
        return umsMemberReceiveAddressDao.selectById(id);
    }

    @Override
    public int delete(Long id) {
        return umsMemberReceiveAddressDao.deleteById(id);
    }
}
